# llvm 目录
#  /home/llvm-project-llvmorg-18.1.0/

cat > /home/l0_local_build_llvm.sh << "EOF"
set -eux

build_core=40

build_llvm=/home/compute_node_local/build-llvm
build_clang=/home/compute_node_local/build-clang
installprefix=/home/compute_node_local/install
llvm=/home/llvm-project-llvmorg-18.1.0/

rm -rf $build_llvm || echo 0
mkdir -p $build_llvm
mkdir -p $installprefix

time cmake -G Ninja -S $llvm/llvm -B $build_llvm \
      -DLLVM_INSTALL_UTILS=ON \
      -DCMAKE_INSTALL_PREFIX=$installprefix \
      -DCMAKE_BUILD_TYPE=Release  2>&1 | tee /home/compute_node_local/build.log

time ninja -C $build_llvm  -j${build_core} 2>&1 | tee /home/compute_node_local/ninja_build.log

EOF


cat > /home/docker_build_l0_local_build_llvm.sh <<"EOF"
docker run --rm \
    -v /home:/home \
    openeuler/openeuler:22.03-lts-sp2-llvm-ccache-distcc \
    bash /home/l0_local_build_llvm.sh
EOF

nohup   bash /home/docker_build_l0_local_build_llvm.sh 2>&1 > /home/l0_local_build.log  &


tail -f /home/l0_local_build.log
